@extends('admin.layout')
@section('title','柜机列表')
@section('body')
    <div id="search" style="height:63px;">
        <blockquote class="layui-elem-quote" style="font-size: 14px">
            <form action="" method="post" class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <a href="javascript:history.back()" class="layui-btn layui-btn-small" >返回</a>
                        <input type="button" onclick="ins()" class="layui-btn layui-btn-small" value="添加">
                    </div>
                </div>

            </form>
        </blockquote>
    </div>

    <table class="layui-table " >
        <thead>
        <tr>
            <th>柜机名字</th>
            <th>柜机CODE</th>
            <th>是否断开连接</th>
        </tr>
        </thead>
        <tbody>
        @foreach($check as $value)
            <tr class="@if($value->status==1) bg-warning  @elseif($value->status==0) bg-success @endif">
                <td>{{$value->name}}</td>
                <td>{{$value->code}}</td>
                <td>{{$value->state==0?"已连接":"未连接"}}</td>
            </tr>
        @endforeach
        </tbody>
    </table>
@endsection
@section('js')

    <script>
        @if(Session::has('message'))
             layer.msg("{{Session::get("message")}}");
        {{Session::forget('message')}}
        @endif
        function ins() {
            layer.open({
                title:"审核",
                content:'是否确认添加一台售货机？<form id="pass" method="post" ><input type="hidden" name="shop_id" value="{{$shop_id}}">{{csrf_field()}}</form>',
                yes:function () {
                    $("#pass").submit();
                    layer.loading();
                }
            });
            event.stopPropagation();
        }


    </script>

@endsection

